Hanye官网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

[id].vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. <template>
  2. <div class="min-h-screen bg-black text-white">
  3. <!-- 顶部间距 -->
  4. <div class="w-full h-[55px] sm:h-[72px]"></div>
  5. <!-- 面包屑导航 -->
  6. <div class="max-w-full xl:px-2 lg:px-2 md:px-4 px-4 mt-6 mb-1 sm:mb-4">
  7. <div class="max-w-screen-2xl mx-auto">
  8. <nuxt-link
  9. :to="`${homepagePath}/`"
  10. class="justify-start text-white/60 text-base font-normal"
  11. >{{ t("common.breadcrumb.home") }}</nuxt-link
  12. >
  13. <span class="text-white/60 text-base font-normal px-2"> / </span>
  14. <nuxt-link
  15. :to="`${homepagePath}/careers`"
  16. class="text-white text-base font-normal"
  17. >{{ t("common.careers") }}</nuxt-link
  18. >
  19. <span class="text-white/60 text-base font-normal px-2"> / </span>
  20. <span class="text-white text-base font-normal">{{ job?.name }}</span>
  21. </div>
  22. </div>
  23. <!-- 主要内容区域 -->
  24. <ErrorBoundary
  25. :error="pageError"
  26. :title="t('common.error')"
  27. :retry="true"
  28. :retry-text="t('common.retry')"
  29. @retry="handleRetry"
  30. >
  31. <div v-if="pending" class="flex justify-center py-12">
  32. <!-- 加载中 -->
  33. <div
  34. class="animate-spin h-8 w-8 border-4 border-cyan-400 rounded-full border-t-transparent"
  35. ></div>
  36. </div>
  37. <!-- 职位详情内容 -->
  38. <div v-else-if="job" class="container mx-auto pb-16">
  39. <div class="grid grid-cols-1 lg:grid-cols-4 gap-8">
  40. <!-- 主要内容 -->
  41. <div class="lg:col-span-3 space-y-8">
  42. <!-- 职位头部信息 -->
  43. <div
  44. class="bg-zinc-900/50 backdrop-blur-sm border border-zinc-700/30 rounded-2xl p-8"
  45. >
  46. <h1 class="text-3xl font-bold text-white mb-4">{{ job.name }}</h1>
  47. <div
  48. class="flex flex-wrap items-center gap-6 text-zinc-400 text-sm mb-4"
  49. >
  50. <span class="flex items-center">
  51. <svg
  52. class="w-4 h-4 mr-2"
  53. fill="none"
  54. stroke="currentColor"
  55. viewBox="0 0 24 24"
  56. >
  57. <path
  58. stroke-linecap="round"
  59. stroke-linejoin="round"
  60. stroke-width="2"
  61. d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"
  62. ></path>
  63. <path
  64. stroke-linecap="round"
  65. stroke-linejoin="round"
  66. stroke-width="2"
  67. d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"
  68. ></path>
  69. </svg>
  70. {{ getLocationName(job.location) }}
  71. </span>
  72. <span class="flex items-center">
  73. <svg
  74. class="w-4 h-4 mr-2"
  75. fill="none"
  76. stroke="currentColor"
  77. viewBox="0 0 24 24"
  78. >
  79. <path
  80. stroke-linecap="round"
  81. stroke-linejoin="round"
  82. stroke-width="2"
  83. d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"
  84. ></path>
  85. </svg>
  86. {{ formatDate(job.createTime) }}
  87. </span>
  88. </div>
  89. <div class="text-xs text-zinc-500">
  90. ID: {{ job.id }} | {{ formatDate(job.updateTime) }}
  91. {{ t("careers.PositionCard.update") }}
  92. </div>
  93. </div>
  94. <!-- 工作职责 -->
  95. <div
  96. class="bg-zinc-900/50 backdrop-blur-sm border border-zinc-700/30 rounded-2xl p-8"
  97. >
  98. <h2
  99. class="text-white text-2xl font-semibold mb-6 flex items-center"
  100. >
  101. <svg
  102. class="w-6 h-6 mr-3 text-[#35F1FF]"
  103. fill="none"
  104. stroke="currentColor"
  105. viewBox="0 0 24 24"
  106. stroke-width="2"
  107. stroke-linecap="round"
  108. stroke-linejoin="round"
  109. >
  110. <rect x="4" y="2" width="16" height="20" rx="2" ry="2" />
  111. <line x1="8" y1="9" x2="16" y2="9" />
  112. <line x1="8" y1="13" x2="16" y2="13" />
  113. </svg>
  114. {{ t("careers.PositionCard.job") }}
  115. </h2>
  116. <div
  117. class="text-zinc-300 leading-relaxed whitespace-pre-line"
  118. v-html="job.jobResponsibilities"
  119. ></div>
  120. </div>
  121. <!-- 薪资福利 -->
  122. <div
  123. class="bg-zinc-900/50 backdrop-blur-sm border border-zinc-700/30 rounded-2xl p-8"
  124. >
  125. <h2
  126. class="text-white text-2xl font-semibold mb-6 flex items-center"
  127. >
  128. <svg
  129. class="w-6 h-6 mr-3 text-[#35F1FF]"
  130. fill="none"
  131. stroke="currentColor"
  132. viewBox="0 0 24 24"
  133. stroke-width="2"
  134. stroke-linecap="round"
  135. stroke-linejoin="round"
  136. >
  137. <path
  138. d="M12 2v20M17 5H9.5a3.5 3.5 0 100 7h5a3.5 3.5 0 110 7H7"
  139. ></path>
  140. </svg>
  141. {{ t("careers.PositionCard.CB") }}
  142. </h2>
  143. <div class="text-zinc-300 leading-relaxed whitespace-pre-line">
  144. {{ job.benefits }}
  145. </div>
  146. </div>
  147. <!-- 工作时间 -->
  148. <div
  149. class="bg-zinc-900/50 backdrop-blur-sm border border-zinc-700/30 rounded-2xl p-8"
  150. >
  151. <h2
  152. class="text-white text-2xl font-semibold mb-6 flex items-center"
  153. >
  154. <svg
  155. class="w-6 h-6 mr-3 text-[#35F1FF]"
  156. fill="none"
  157. stroke="currentColor"
  158. viewBox="0 0 24 24"
  159. stroke-width="2"
  160. stroke-linecap="round"
  161. stroke-linejoin="round"
  162. >
  163. <rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
  164. <line x1="16" y1="2" x2="16" y2="6"></line>
  165. <line x1="8" y1="2" x2="8" y2="6"></line>
  166. <line x1="3" y1="10" x2="21" y2="10"></line>
  167. </svg>
  168. {{ t("careers.PositionCard.workingHours") }}
  169. </h2>
  170. <div class="text-zinc-300 leading-relaxed whitespace-pre-line">
  171. {{ job.workTime }}
  172. </div>
  173. </div>
  174. </div>
  175. <!-- 侧边栏 - 申请信息 -->
  176. <div class="lg:col-span-1">
  177. <div class="sticky top-8">
  178. <div
  179. class="bg-zinc-900/50 backdrop-blur-sm border border-zinc-700/30 rounded-2xl p-6"
  180. >
  181. <div class="text-center mb-6">
  182. <div
  183. class="inline-flex items-center justify-center w-16 h-16 bg-[#35F1FF]/10 rounded-full mb-4"
  184. >
  185. <svg
  186. class="w-8 h-8 text-[#35F1FF]"
  187. fill="none"
  188. stroke="currentColor"
  189. viewBox="0 0 24 24"
  190. >
  191. <path
  192. stroke-linecap="round"
  193. stroke-linejoin="round"
  194. stroke-width="2"
  195. d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
  196. ></path>
  197. </svg>
  198. </div>
  199. <h3 class="text-xl font-semibold text-white mb-2">
  200. {{ t("careers.jobs.button") }}
  201. </h3>
  202. </div>
  203. <!-- 邮箱信息 -->
  204. <div class="bg-zinc-800/30 rounded-xl p-4 mb-6">
  205. <div class="text-sm text-zinc-400 mb-2">
  206. {{ t("contact.email") }}
  207. </div>
  208. <div class="text-[#35F1FF] font-medium break-all mb-3">
  209. {{ job.email }}
  210. </div>
  211. <button
  212. @click="copyEmail"
  213. class="w-full px-4 py-3 bg-[#35F1FF]/10 text-[#35F1FF] font-medium rounded-lg hover:bg-[#35F1FF]/20 transition-colors"
  214. >
  215. {{ copied ? t("common.copied") : t("common.copy") }}
  216. </button>
  217. </div>
  218. <!-- 申请提示 -->
  219. <div class="text-xs text-zinc-500 text-center leading-relaxed">
  220. {{ t("careers.jobs.sendTip") }}
  221. </div>
  222. </div>
  223. </div>
  224. </div>
  225. </div>
  226. </div>
  227. <!-- 未找到职位 -->
  228. <div v-else class="container mx-auto px-4 py-16 text-center">
  229. <div
  230. class="inline-flex items-center justify-center w-16 h-16 bg-zinc-800/30 rounded-full mb-4"
  231. >
  232. <svg
  233. class="w-8 h-8 text-zinc-400"
  234. fill="none"
  235. stroke="currentColor"
  236. viewBox="0 0 24 24"
  237. >
  238. <path
  239. stroke-linecap="round"
  240. stroke-linejoin="round"
  241. stroke-width="2"
  242. d="M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2-2v2m8 0H8m8 0v2a2 2 0 002 2M8 6V4h8V6M8 6v2a2 2 0 002 2h4a2 2 0 002-2V6"
  243. ></path>
  244. </svg>
  245. </div>
  246. <p class="text-zinc-400 mb-4">{{ t("careers.notFound") }}</p>
  247. <NuxtLink
  248. to="/careers"
  249. class="inline-flex items-center px-4 py-2 bg-[#35F1FF]/10 text-[#35F1FF] rounded-lg hover:bg-[#35F1FF]/20 transition-colors"
  250. >
  251. {{ t("careers.backToList") }}
  252. </NuxtLink>
  253. </div>
  254. </ErrorBoundary>
  255. </div>
  256. </template>
  257. <script setup lang="ts">
  258. import type { JobApiResponse, Job } from "~/data/jobs";
  259. import { locationMap, workTypeMap } from "~/data/jobs";
  260. import { useClipboard } from "@vueuse/core";
  261. /**
  262. * 获取路由参数
  263. */
  264. const route = useRoute();
  265. const { t, locale } = useI18n();
  266. // 计算首页路径
  267. const homepagePath = computed(() => {
  268. return locale.value === "zh" ? "" : `/${locale.value}`;
  269. });
  270. // API配置
  271. const apiUrl = computed(
  272. () =>
  273. `https://digital.sohomall.jp/prod-api/system/workInfo/noVerify/${route.params.id}`
  274. );
  275. const {
  276. data: apiResponse,
  277. pending,
  278. error: pageError,
  279. refresh: handleRetry,
  280. } = await useFetch<JobApiResponse>(apiUrl, {});
  281. // 从响应中获取职位信息
  282. const job = computed<Job | null>(() => apiResponse.value?.data ?? null);
  283. useHead(() => {
  284. const title = job.value
  285. ? `${job.value.name} - ${t("common.careers")} - Hanye`
  286. : t("careers.notFound");
  287. const description = job.value
  288. ? job.value.jobResponsibilities.substring(0, 150)
  289. : t("careers.notFoundDescription", "Could not find the job details.");
  290. return {
  291. title,
  292. meta: [{ name: "description", content: description }],
  293. };
  294. });
  295. /**
  296. * 获取地点名称
  297. * @param locationId 地点ID
  298. * @returns 地点名称
  299. */
  300. const getLocationName = (locationId: number): string => {
  301. return (
  302. locationMap[locationId] || t("careers.unknownLocation", "Unknown Location")
  303. );
  304. };
  305. /**
  306. * 格式化日期
  307. * @param dateString 日期字符串
  308. * @returns 格式化后的日期
  309. */
  310. const formatDate = (dateString?: string): string => {
  311. if (!dateString) return "";
  312. const date = new Date(dateString);
  313. // 使用 toLocaleDateString 以支持国际化
  314. return date.toLocaleDateString(locale.value, {
  315. year: "numeric",
  316. month: "long",
  317. day: "numeric",
  318. });
  319. };
  320. // 复制邮箱功能
  321. const { copy, copied, isSupported } = useClipboard({
  322. source: computed(() => job.value?.email ?? ""),
  323. copiedDuring: 2000,
  324. legacy: true,
  325. });
  326. /**
  327. * 复制邮箱地址到剪贴板
  328. */
  329. const copyEmail = async () => {
  330. if (!job.value?.email) return;
  331. if (!isSupported.value) {
  332. alert(
  333. t("common.copyNotSupported", "Copying is not supported in your browser.")
  334. );
  335. return;
  336. }
  337. try {
  338. await copy();
  339. } catch (err) {
  340. console.error("Failed to copy email: ", err);
  341. alert(t("common.copyFailed", "Failed to copy email."));
  342. }
  343. };
  344. </script>